home *** CD-ROM | disk | FTP | other *** search
- Path: fido.asd.sgi.com!austern
- From: "Aaron S. Binns" <asbinn@rstcorp.com>
- Newsgroups: comp.std.c++,comp.lang.c++
- Subject: 'const' binding to specifier in declaration list
- Followup-To: comp.std.c++
- Date: 16 Apr 1996 13:17:21 PDT
- Organization: Reliable Software Technologies
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <3173B383.41C67EA6@rstcorp.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Tue, 16 Apr 1996 10:49:39 -0400
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3 sun4c)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMXQAUky4NqrwXLNJAQFGawIAnGEu49r8YllpssaySJ4ApM3h7931IOWY
- b282FTnY9DXSCg73Ig4ld1JtRTcP6QxRy0LxskKvQmAN13wrD0Wl+A==
- =wGec
- Originator: austern@isolde.mti.sgi.com
-
- [Moderator's note: This is crossposted to comp.std.c++ and
- comp.lang.c++, and followups have been set to comp.std.c++. mha]
-
- I recently came across a piece of code that reads:
-
- class A {
- // contents of class A
- } a1, *a2, const *a3;
-
-
- This looks pretty bogus to me. I thought that the 'const' applied
- to the elaborated specifier 'class A'. If the 'const' qualifier is
- supposed to apply to the pointer in 'a3', then it should come _after_
- the '*'.
-
- I think that either one of the two following was intended.
-
- 1)
-
- class A {
- // contents of class A
- } a1, *a2, * const a3;
-
-
- 2)
-
- class A {
- // contents of class A
- } a1, *a2;
-
- A const *a3; // Or const A *a3;
-
-
- Is my interpretation of the binding of 'const' more or less correct?
-
- BTW, this code _is_ accepted by the Microsoft VC/C++ v2.0 compiler.
-
-
- --
- Aaron S. Binns Reliable Software Technologies Corp.
- 21515 Ridgetop Circle, Suite 250
- asbinn@rstcorp.com Sterling, VA 20166
- http://www.rstcorp.com
- ---
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-